//
//  GSCommentView.m
//  GameSky
//
//  Created by lanou on 16/1/14.
//  Copyright © 2016年 NiRongfei. All rights reserved.
//

#import "GSCommentView.h"

@implementation GSCommentView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // 夜间模式
        self.dk_backgroundColorPicker = DKColorWithRGB(0xffffff, 0x343434);
        self.layer.shadowColor = [UIColor blackColor].CGColor;
        self.layer.shadowOffset = CGSizeMake(0, 0);
        self.layer.shadowOpacity = 0.5;
        
        // 1.添加导航栏;
        self.navBar = [[GSCustomNavigationBar alloc] initWithFrame:CGRectMake(0, 0, kWidth, 64)];
        [self addSubview:self.navBar];
        // 左边按钮
        [self.navBar.leftButton setImage:[UIImage imageNamed:@"common_Icon_Back_20x20_UIMode_Day"] forState:(UIControlStateNormal)];
        
        // 2.添加工具栏;
        UIView *toolBar = [[UIView alloc] initWithFrame:CGRectMake(0, kHeight - 40, kHeight, 40)];
        toolBar.dk_backgroundColorPicker = DKColorWithRGB(0xffffff, 0x343434);
        [self addSubview:toolBar];
        // 提交按钮
        self.commitBtn = [[GSBorderButton alloc] initWithFrame:CGRectMake(10, 5, 60, 30)];
        self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:15];
        [self.commitBtn setTitle:@"评论" forState:(UIControlStateNormal)];
        [self.commitBtn setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)];
        [toolBar addSubview:self.commitBtn];
        // 评论按钮
        _commentBtn = [[GSCommentButton alloc] initWithFrame:CGRectMake(self.commitBtn.right + 10, 5, kWidth - self.commitBtn.width - 30, 30)];
        _commentBtn.layer.cornerRadius = 5;
        _commentBtn.layer.borderWidth = 0.5;
        _commentBtn.layer.borderColor = [UIColor lightGrayColor].CGColor;
        _commentBtn.titleLabel.font = [UIFont systemFontOfSize:15];
        _commentBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);
        _commentBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        [_commentBtn setTitle:@"我来说几句..." forState:(UIControlStateNormal)];
        [_commentBtn setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)];
        [_commentBtn addTarget:self action:@selector(commentBtnClick:) forControlEvents:(UIControlEventTouchUpInside)];
        [toolBar addSubview:_commentBtn];
    }
    return self;
}
// 评论按钮点击方法;
- (void)commentBtnClick:(GSCommentButton *)button
{
    [button becomeFirstResponder];    
}

@end
